package com.hsm8;

public interface TestInterface {
    /*public static final*/ int NUM = 10;
    /*public abstract*/ void a();
    /*public abstract */void b(int num);
    int c(String name);
    //接口中的修饰符不写也没有关系，系统默认会自己补上
}

interface TestInterface1{
    void e();
    void f();
}
//方式1
/*class Student implements TestInterface{
    @Override
    public void a() {
        System.out.println("a");
    }

    @Override
    public void b(int num) {
        System.out.println("b");
    }

    @Override
    public int c(String name) {
        return 0;
    }
}*/
//方式2 ,将这个类变成抽象类
class Student extends Person implements TestInterface,TestInterface1{
    @Override
    public void a() {
        System.out.println("a");
    }

    @Override
    public void b(int num) {
        System.out.println("b");
    }

    @Override
    public int c(String name) {
        return 0;
    }

    @Override
    public void e() {
        System.out.println("e");
    }

    @Override
    public void f() {
        System.out.println("f");
    }
}

class Test{
    public static void main(String[] args) {
        //接口是用来被实现的，并不能直接用来创建对象
        // TestInterface t = new TestInterface();
        TestInterface t = new Student();
        //这样写是可以的，父类引用指向子类对象，是向上转型的过程

        //如何访问接口中的常量
        System.out.println(TestInterface.NUM);
        System.out.println(Student.NUM);
        Student hsm = new Student();
        System.out.println(hsm.NUM);
        TestInterface t2 = new Student();
        System.out.println(t2.NUM);
    }
}
